package cn.persistenceCollection.demos;

import cn.persistenceCollection.JdkSerializer;
import cn.persistenceCollection.PersistenceContext;
import cn.persistenceCollection.fileBasedImpl.FilePersistenceSet;
import com.easy.server.persistenceCollection.FileMapperType;

import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class JavaDemo {
    public static void main(String[] args) {

        PersistenceContext persistenceContext = new PersistenceContext(".");

        persistenceContext.setDefaultFileMapperType(FileMapperType.MemoryMapMapper);
        persistenceContext.setFlushPerOption(false);
        persistenceContext.setFlushIntervalMills(1000);
        persistenceContext.setMapOrSetValueRedundancyBytesRatio(-1);

        List<String> list = persistenceContext.openArrayList("list", new JdkSerializer<>(String.class), 100);
        list.add("666");
        System.out.println(list);
        persistenceContext.close();
    }
}
